<?php $user=$session->read('User');
$companyid=$session->read("companyid");
?>
<div class="right_side_operate_area">
	<div class="right_side_title left">
		<h2>
		<?php 
		$companyname=$session->read("companyname");
		echo $html->link($companyname,"/companys/showinfosummary/".$companyid);
		?>
		</h2>
		<div class="clear"></div>
	</div>
    <div class="right item_add_btn">
    <?php 
    	if($form->value('CompDormitorylease.id'))
    	{
    		$str_title=__("Edit",true);
		}
		else
		{
			$str_title=__("Add",true);
		}
		echo $html->link(__("Cancel",true).$str_title,"/companys/dormitorylease/");
    ?>
    </div>
    <div class="clear"></div>
</div>

<div class="right_side_scollbar">
    <div class="detail_info_panel">
    
    	<?php echo $form -> create('companys', array('action' => 'editdormitorylease','type'=> 'post','onsubmit'=>'return  checkedinfo()') ); ?>
		<div class="details_item_line">
	      <div class="details_item">
	      <div class="form_left_title left">宿舍位置：</div>
	      <div class="form_right_e_input left"><?php echo $form->text('CompDormitorylease.location');?></div>
	       <div id='locationmessage' style='display:none;' class="error_message">请填写宿舍位置</div>
	      </div>
		</div>
		
		<div class="details_item_line">
	      <div class="details_item">
	      <div class="form_left_title left">宿舍大小：</div>
	      <div class="form_right_e_input left"><?php echo $form->text('CompDormitorylease.area',array("placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?> ㎡</div>
	       <div id='areamessage' style='display:none;' class="error_message">请填写宿舍大小</div>
	      </div>
		</div>
		
	     <div class="details_item_line">
			<div class="details_item">
			    <div class="form_left_title left">开始日期：</div>
			    <div class="form_right_e_input form_date_picker left">
			    	<?php echo $form->text('CompDormitorylease.starttime',array("maxlength"=>"10","style"=>"width:130px","onfocus"=>"WdatePicker()"));?>
			    </div>
			    <div id='startmessage' style='display:none;' class="error_message">请选择开始日期</div>
			</div>
	   </div>
	   <div class="details_item_line">
			<div class="details_item">
			    <div class="form_left_title left">截止日期：</div>
			    <div class="form_right_e_input form_date_picker left">
			    	<?php echo $form->text('CompDormitorylease.deadline',array("maxlength"=>"10","style"=>"width:130px","onfocus"=>"WdatePicker()"));?>
			    </div>
			    <div id='deadlinemessage' style='display:none;' class="error_message">请选择截止日期</div>
			</div>
	   </div>
		
		<div class="details_item_line">
	      <div class="details_item">
	      <div class="form_left_title left">租金金额：</div>
	      <div class="form_right_e_input left"><?php echo $form->text('CompDormitorylease.rent',array("placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?>￥</div>
	       <div id='rentmessage' style='display:none;' class="error_message">请填写租金金额</div>
	      </div>
		</div>
		
		 <div class="details_item_line">
			<div class="details_item">
				<div class="form_left_title left"></div>
		        <div class="form_add_submit left">
		        	<?php echo $form->submit(__('Save',true), array("id"=>"addactive","name"=>"submit","class"=>"buttom","div"=>false));  ?>
		            <?php echo $form->hidden('CompDormitorylease.cid',array("value"=>$companyid)) ;?>
		        	<?php echo $form->hidden('CompDormitorylease.id') ?>
		        </div>
			</div>
		</div>
		
		
    </div>
</div>

<script>

function checkedinfo(){
	 if($("#CompDormitoryleaseLocation").val().trim() == ''){
			$("#locationmessage").css('display','block');
			return false;
	  }else{
		 	 $("#locationmessage").css('display','none');
		  }
		  
	  if($("#CompDormitoryleaseArea").val().trim() == ''){
			$("#areamessage").css('display','block');
			return false;
	  }else{
		 	 $("#areamessage").css('display','none');
		  }
		  
	   if($("#CompDormitoryleaseDeadline").val().trim() == ''){
			$("#deadlinemessage").css('display','block');
			return false;
	  }else{
		 	 $("#deadlinemessage").css('display','none');
		  }
		  
	 if($("#CompDormitoryleaseRent").val().trim() == ''){
			$("#rentmessage").css('display','block');
			return false;
	  }else{
		 	 $("#rentmessage").css('display','none');
		  }
}
</script>
